package model

import (
	"qabx.net/safe-app-center/pkg/utils"
	"time"
)

type TblMaliciousInterceptLog struct {
	MaliciousInterceptId int
	GatewayId            int
	DeviceId             int
	SourceIp             string
	SourcePort           string
	DestIp               string
	DestPort             string
	InterceptTime        string
	Url                  string
	UserAgent            string
	Referer              string
	InterceptRoleId      int
	CreateTime           string
	UpdateTime           string
	IsDel                int
}

func (s *TblMaliciousInterceptLog) AddMaliciousInterceptLog() error {
	dbClient, _ := utils.GetDbClient()

	s.CreateTime = time.Now().Format("2006-01-02 15:04:05")
	s.UpdateTime = time.Now().Format("2006-01-02 15:04:05")
	s.IsDel = 0
	dbClient.InsertParam = utils.InsertParam{
		Resource: s,
		Table:    "tbl_malicious_intercept_log",
	}
	_, err := dbClient.Insert()
	if err != nil {
		return err
	}
	return err

}
